package cn.hfjava.pojo.cn.bdqn;

import java.util.Scanner;

public class Calcolate {




    public static void main(String[] args) {
            double result =0.0;
        Calculator calculator=new Calculator();
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入第一个数：");
        calculator.numberA=sc.nextInt();
        System.out.println("请输入运算符(+,-,*,/):");
        char cr =sc.next().charAt(0);
        System.out.print("请输入第二个数：");
        calculator.numberB =sc.nextInt();
        switch (cr){
            case '+':
                System.out.println(calculator.numberA+calculator.numberB);
                break;
            case '-':
                System.out.println(calculator.numberA-calculator.numberB);
                break;
            case '*':
                System.out.println(calculator.numberA*calculator.numberB);
                break;
            case '/':
                if (calculator.numberB==0)
                {
                    System.out.println("除数不能为0");}
                    else {
                System.out.println(calculator.numberA/calculator.numberB);}
                break;
        }
    }
}
